home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Information / WebSites / Wirenet / files / Dashboard2.lha / Dashboard2 / AmiTCP / bin / SendEvents < prev    next >
Text File  |  1998-03-27  |  3KB  |  96 lines

  1. /*
  2. $VER: SendEvents 2.0 (26.3.98)
  3. (c) Neil Bothwick
  4.  
  5. Check if there are any outstanding events and if
  6. so send them.
  7. This version works with multiple systems
  8. */
  9.  
  10. /* ;;;Change these to suit your setup */
  11. MaxTries   = 5                          /* Maximum number of retries */
  12. Logging    = 1                          /* Turn on logging, only use with Thor 2.3 and above */
  13. LogFile    = 'UUSpool:Info.log'
  14. ;;;
  15. /* ;;;Don't change anything below here */
  16. parse upper arg args
  17. if args = FTP then DoFTP = 1
  18. EVE_DOWNLOAD     =  4
  19. EVE_UPLOAD       =  5
  20. address command
  21. ;;;
  22. /* ;;; Execute PreSend script */
  23. if exists('Wirenet:UserScripts/PreSend') then address command 'Wirenet:UserScripts/PreSend'
  24. ;;;
  25. /* ;;;Load libraries and get system information */
  26. if ~show('p', 'BBSREAD') then do
  27.     "run >nil: `GetEnv THOR/THORPath`bin/LoadBBSRead"
  28.     "WaitForPort BBSREAD"
  29.     end
  30.  
  31. address BBSREAD
  32. drop Systems.
  33. 'GETBBSLIST stem SYSTEMS'
  34.  
  35. if Logging = 1 then TempLog = 'T:Send.'||time(s)
  36. ;;;
  37. /* ;;;Send events for each relevant system */
  38. do i = 1 to Systems.COUNT
  39.     address BBSREAD
  40.     SystemName = Systems.i
  41.     drop SysData.
  42.     'GETBBSDATA "'SystemName'" stem SYSDATA'
  43.     if left(SysData.BBSTYPE,3) ~= 'TCP' then iterate
  44.  
  45.     address command
  46.     CmdStr = GetVar('Thor/ThorPath')||'bin/SendTCP BBSNAME' SystemName 'MAILSERVER' getclip('SMTPServer') 'NEWSSERVER' getclip('NewsServer') 'PUBSCREEN ""'
  47.     if Logging = 1 then CmdStr = CmdStr 'LOGFILE' TempLog
  48.  
  49.     do Try = 1 to MaxTries
  50.         if ActiveEvents('NOFTP') > 0 then do
  51.             CmdStr 'NOFTP'
  52.             end
  53.         If ActiveEvents('NOFTP') > 0 then say 'SendTCP failed for' SystemName
  54.         end
  55.  
  56.     /* Do FTP after mail and news */
  57.     if getclip('AminetServer') > '' then CmdStr = CmdStr 'AMINETSERVER' getclip('AminetServer')
  58.     if getclip('DownloadDir') > '' then CmdStr = CmdStr 'AMINETDLDIR' getclip('DownloadDir')
  59.     if getclip('AminetRoot') > '' then CmdStr = CmdStr 'AMINETBASEDIR' getclip('AminetRoot')
  60.     if getclip('GetReadme') = 1 then CmdStr = CmdStr 'GETREADME'
  61.     do Try = 1 to MaxTries
  62.         if ActiveEvents() > 0 then do
  63.             CmdStr
  64.             end
  65.         end
  66.     If ActiveEvents() > 0 then say 'SendTCP failed for' SystemName
  67.     end
  68.  
  69. if Logging = 1 then address command 'run >NIL: ShowLog' TempLog req log info
  70. ;;;
  71.  
  72. exit
  73.  
  74. /* ;;;Check for active events in this system */
  75. ActiveEvents:
  76.     arg evtype
  77.     address BBSREAD
  78.     ActiveCount = 0
  79.     GETBBSDATA SystemName SystemData
  80.     do EventNo=SystemData.FIRSTEVENT to SystemData.LASTEVENT
  81.         drop EventData.
  82.         drop EventTags.
  83.         READBREVENT '"'SystemName'"' eventnr EventNo datastem EventData tagsstem EventTags
  84.         EventFlags = c2x(EventData.FLAGS)
  85.         if EventFlags = 0 | EventFlags = 8 then do
  86.             if evtype = 'NOFTP' then do
  87.                 if  EventData.EVENTTYPE ~= EVE_DOWNLOAD & EventData.EVENTTYPE ~= EVE_UPLOAD then return 1
  88.                 end
  89.             else return 1
  90.             end
  91.         end
  92.     address command
  93.     return 0
  94. ;;;
  95.  
  96.